package file;

import java.io.File;

public class DeleteDirDemo {
    public static void main(String[] args) {
        File dir = new File("./dir.txt");
        //将当前目录下的demo目录删除
        if (dir.exists()) {
            dir.delete(); //delete方法删除目录时只能删除空目录
            System.out.println("已删除");
        }else{
            System.out.println("不存在");
        }
    }
}
